<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>GeoExt.PrintMapPanel &mdash; GeoExt v1.0</title>
    <link rel="stylesheet" href="../../../_static/geoext.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.0',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
    <link rel="top" title="GeoExt v1.0" href="../../../index.html" />
    <link rel="up" title="Widgets" href="../widgets.html" />
    <link rel="next" title="GeoExt.UrlLegend" href="UrlLegend.html" />
    <link rel="prev" title="GeoExt.Popup" href="Popup.html" />
    
    
    
    
    

  </head>
  <body>
    <div class="header">
        <div class="wrap">
            <h1 id="logo"><a href="../../../index.html">GeoExt</a></h1>
            <ul id="top-nav">
                <li class="first"><a href="../../../docs.html">Documentation</a></li>
                <li><a href="../../../examples.html">Examples</a></li>
                <li><a href="../../../downloads.html">Download</a></li>
                <li><a href="http://trac.geoext.org/">Development</a></li>
            </ul>
            <div id="searchbox">
                <form class="search" action="../../../search.html" method="get">
                    <input id="searchbox-query" type="text" name="q" size="25" value="Search &hellip;" tabindex="3" onblur="if(this.value=='') this.value='Search &hellip;';" onfocus="if(this.value=='Search &hellip;') this.value='';" />
                    <input id="searchbox-submit" type="image" value="Search" src="../../../_static/img/search_icon_green.png" />
                    <input type="hidden" name="check_keywords" value="yes" />
                    <input type="hidden" name="area" value="default" />
                </form>
            </div>
        </div>
    </div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li><a href="../../../index.html">GeoExt</a> &raquo;</li>
          <li><a href="../../index.html" >API Reference</a> &raquo;</li>
          <li><a href="../widgets.html" accesskey="U">Widgets</a> &raquo;</li>
        <li><a href="#"><tt class="docutils literal docutils literal"><span class="pre">GeoExt.PrintMapPanel</span></tt></a></li>
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../../../index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#"><tt class="docutils literal"><span class="pre">GeoExt.PrintMapPanel</span></tt></a><ul>
<li><a class="reference external" href="#example-use">Example Use</a></li>
<li><a class="reference external" href="#config-options">Config Options</a></li>
<li><a class="reference external" href="#public-properties">Public Properties</a></li>
<li><a class="reference external" href="#public-methods">Public Methods</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="Popup.html"
                                  title="previous chapter"><tt class="docutils literal docutils literal docutils literal"><span class="pre">GeoExt.Popup</span></tt></a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="UrlLegend.html"
                                  title="next chapter"><tt class="docutils literal"><span class="pre">GeoExt.UrlLegend</span></tt></a></p>
        </div>
      </div>


    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="geoext-printmappanel">
<h1><a title="GeoExt.PrintMapPanel" class="reference internal" href="#GeoExt.PrintMapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.PrintMapPanel</span></tt></a><a class="headerlink" href="#geoext-printmappanel" title="Permalink to this headline">¶</a></h1>
<dl class="meta docutils">
<dt>Extends</dt>
<dd><ul class="first last simple">
<li><a class="reference external" href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.Panel">Ext.Panel</a></li>
<li><a title="GeoExt.MapPanel" class="reference external" href="MapPanel.html#GeoExt.MapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.MapPanel</span></tt></a></li>
</ul>
</dd>
<dt>xtype</dt>
<dd><tt class="docutils literal"><span class="pre">gx_printmappanel</span></tt></dd>
</dl>
<dl class="class">
<dt id="GeoExt.PrintMapPanel">
<em class="property">class </em><tt class="descclassname">GeoExt.</tt><tt class="descname">PrintMapPanel</tt><a class="headerlink" href="#GeoExt.PrintMapPanel" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>A map panel that controls scale and center of a print page. Based on the
current view (i.e. layers and extent) of a source map, this panel will be
sized according to the aspect ratio of the print page. As the user zooms
and pans in the <a title="GeoExt.PrintMapPanel" class="reference internal" href="#GeoExt.PrintMapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.PrintMapPanel</span></tt></a>, the print page will update
its scale and center accordingly. If the scale on the print page changes
(e.g. by setting it using a combo box with a
<a title="GeoExt.plugins.PrintPageField" class="reference external" href="../plugins/PrintPageField.html#GeoExt.plugins.PrintPageField"><tt class="xref docutils literal"><span class="pre">GeoExt.plugins.PrintPageField</span></tt></a>), the extent of the
<a title="GeoExt.PrintMapPanel" class="reference internal" href="#GeoExt.PrintMapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.PrintMapPanel</span></tt></a> will be updated to match the page bounds.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <tt class="docutils literal"><span class="pre">zoom</span></tt>, <tt class="docutils literal"><span class="pre">center</span></tt> and <tt class="docutils literal"><span class="pre">extent</span></tt> config options will have
no affect, as they will be determined by the <tt class="docutils literal"><span class="pre">sourceMap</span></tt>.</p>
</div>
<div class="section" id="example-use">
<h2>Example Use<a class="headerlink" href="#example-use" title="Permalink to this headline">¶</a></h2>
<p>A map with a &#8220;Print...&#8221; button. If clicked, a dialog containing a
PrintMapPanel will open, with a &#8220;Create PDF&#8221; button.</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="kd">var</span> <span class="nx">mapPanel</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">MapPanel</span><span class="p">({</span>
    <span class="nx">renderTo</span><span class="o">:</span> <span class="s2">&quot;map&quot;</span><span class="p">,</span>
    <span class="nx">layers</span><span class="o">:</span> <span class="p">[</span><span class="k">new</span> <span class="nx">OpenLayers</span><span class="p">.</span><span class="nx">Layer</span><span class="p">.</span><span class="nx">WMS</span><span class="p">(</span><span class="s2">&quot;Tasmania State Boundaries&quot;</span><span class="p">,</span>
        <span class="s2">&quot;http://demo.opengeo.org/geoserver/wms&quot;</span><span class="p">,</span>
        <span class="p">{</span><span class="nx">layers</span><span class="o">:</span> <span class="s2">&quot;topp:tasmania_state_boundaries&quot;</span><span class="p">},</span> <span class="p">{</span><span class="nx">singleTile</span><span class="o">:</span> <span class="kc">true</span><span class="p">})],</span>
    <span class="nx">center</span><span class="o">:</span> <span class="p">[</span><span class="mf">146.56</span><span class="p">,</span> <span class="o">-</span><span class="mf">41.56</span><span class="p">],</span>
    <span class="nx">zoom</span><span class="o">:</span> <span class="mi">6</span><span class="p">,</span>
    <span class="nx">bbar</span><span class="o">:</span> <span class="p">[{</span>
        <span class="nx">text</span><span class="o">:</span> <span class="s2">&quot;Print...&quot;</span><span class="p">,</span>
        <span class="nx">handler</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">printDialog</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Ext</span><span class="p">.</span><span class="nx">Window</span><span class="p">({</span>
                <span class="nx">autoHeight</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
                <span class="nx">width</span><span class="o">:</span> <span class="mi">350</span><span class="p">,</span>
                <span class="nx">items</span><span class="o">:</span> <span class="p">[</span><span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">PrintMapPanel</span><span class="p">({</span>
                    <span class="nx">sourceMap</span><span class="o">:</span> <span class="nx">mapPanel</span><span class="p">,</span>
                    <span class="nx">printProvider</span><span class="o">:</span> <span class="p">{</span>
                        <span class="nx">capabilities</span><span class="o">:</span> <span class="nx">printCapabilities</span>
                    <span class="p">}</span>
                <span class="p">})],</span>
                <span class="nx">bbar</span><span class="o">:</span> <span class="p">[{</span>
                    <span class="nx">text</span><span class="o">:</span> <span class="s2">&quot;Create PDF&quot;</span><span class="p">,</span>
                    <span class="nx">handler</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
                        <span class="nx">printDialog</span><span class="p">.</span><span class="nx">items</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">print</span><span class="p">();</span>
                    <span class="p">}</span>
                <span class="p">}]</span>
            <span class="p">});</span>
            <span class="nx">printDialog</span><span class="p">.</span><span class="nx">show</span><span class="p">();</span>
        <span class="p">}</span>
    <span class="p">}]</span>
<span class="p">});</span>
</pre></div>
</div>
</div>
<div class="section" id="config-options">
<h2>Config Options<a class="headerlink" href="#config-options" title="Permalink to this headline">¶</a></h2>
<p>Configuration properties in addition to
those listed for <a class="reference external" href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.Panel">Ext.Panel</a>.</p>
<dl class="describe">
<dt>
<tt class="descname">center</tt></dt>
<dd><tt class="docutils literal"><span class="pre">OpenLayers.LonLat</span></tt> or <tt class="docutils literal"><span class="pre">Array(Number)</span></tt>  A location for the map
center. Do not set, as this will be overridden with the <tt class="docutils literal"><span class="pre">sourceMap</span></tt>
center.</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">extent</tt></dt>
<dd><tt class="docutils literal"><span class="pre">OpenLayers.Bounds</span> <span class="pre">or</span> <span class="pre">Array(Number)</span></tt>  An initial extent for the map.
Do not set, because the initial extent will be determined by the
<tt class="docutils literal"><span class="pre">sourceMap</span></tt>.</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">layers</tt></dt>
<dd><tt class="docutils literal"><span class="pre">GeoExt.data.LayerStore</span> <span class="pre">or</span> <span class="pre">GeoExt.data.GroupingStore</span> <span class="pre">or</span> <span class="pre">Array(OpenLayers.Layer)</span></tt>
A store holding records. The layers provided here will be added to this
MapPanel&#8217;s map when it is rendered.</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">limitScales</tt></dt>
<dd><tt class="docutils literal"><span class="pre">Boolean</span></tt> If set to true, the printPage cannot be set to scales that
would generate a preview in this <a title="GeoExt.PrintMapPanel" class="reference internal" href="#GeoExt.PrintMapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.PrintMapPanel</span></tt></a> with a
completely different extent than the one that would appear on the
printed map. Default is false.</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">map</tt></dt>
<dd><tt class="docutils literal"><span class="pre">Object</span></tt> Optional configuration for the <tt class="docutils literal"><span class="pre">OpenLayers.Map</span></tt> object
that this PrintMapPanel creates. Useful e.g. to configure a map with a
custom set of controls, or to add a <tt class="docutils literal"><span class="pre">preaddlayer</span></tt> listener for
filtering out layer types that cannot be printed.</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">prettyStateKeys</tt></dt>
<dd><tt class="docutils literal"><span class="pre">Boolean</span></tt> Set this to true if you want pretty strings in the MapPanel&#8217;s
state keys. More specifically, layer.name instead of layer.id will be used
in the state keys if this option is set to true. But in that case you have
to make sure you don&#8217;t have two layers with the same name. Defaults to
false.</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">printProvider</tt></dt>
<dd><p><a title="GeoExt.data.PrintProvider" class="reference external" href="../data/PrintProvider.html#GeoExt.data.PrintProvider"><tt class="xref docutils literal"><span class="pre">GeoExt.data.PrintProvider</span></tt></a> or <tt class="docutils literal"><span class="pre">Object</span></tt> PrintProvider to use
for printing. If an <tt class="docutils literal"><span class="pre">Object</span></tt> is provided, a new PrintProvider will
be created and configured with the object.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The PrintMapPanel requires the printProvider&#8217;s capabilities
to be available upon initialization. This means that a PrintMapPanel
configured with an <tt class="docutils literal"><span class="pre">Object</span></tt> as <tt class="docutils literal"><span class="pre">printProvider</span></tt> will only work
when <tt class="docutils literal"><span class="pre">capabilities</span></tt> is provided in the printProvider&#8217;s
configuration object. If <tt class="docutils literal"><span class="pre">printProvider</span></tt> is provided as an instance
of <a title="GeoExt.data.PrintProvider" class="reference external" href="../data/PrintProvider.html#GeoExt.data.PrintProvider"><tt class="xref docutils literal"><span class="pre">GeoExt.data.PrintProvider</span></tt></a>, the capabilities must be
loaded before PrintMapPanel initialization.</p>
</div>
</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">sourceMap</tt></dt>
<dd><a title="GeoExt.MapPanel" class="reference external" href="MapPanel.html#GeoExt.MapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.MapPanel</span></tt></a> or <tt class="docutils literal"><span class="pre">OpenLayers.Map</span></tt> The map that is to be
printed.</dd></dl>

<dl class="describe">
<dt>
<tt class="descname">zoom</tt></dt>
<dd><tt class="docutils literal"><span class="pre">Number</span></tt>  An initial zoom level for the map. Do not set, because the
initial extent will be determined by the <tt class="docutils literal"><span class="pre">sourceMap</span></tt>.</dd></dl>

</div>
<div class="section" id="public-properties">
<h2>Public Properties<a class="headerlink" href="#public-properties" title="Permalink to this headline">¶</a></h2>
<p>Public properties in addition to those
listed for <a class="reference external" href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.Panel">Ext.Panel</a>.</p>
<dl class="attribute">
<dt id="GeoExt.PrintMapPanel.layers">
<tt class="descclassname">PrintMapPanel.</tt><tt class="descname">layers</tt><a class="headerlink" href="#GeoExt.PrintMapPanel.layers" title="Permalink to this definition">¶</a></dt>
<dd><a title="GeoExt.data.LayerStore" class="reference external" href="../data/LayerStore.html#GeoExt.data.LayerStore"><tt class="xref docutils literal"><span class="pre">GeoExt.data.LayerStore</span></tt></a>  A store containing
<a title="GeoExt.data.LayerRecord" class="reference external" href="../data/LayerRecord.html#GeoExt.data.LayerRecord"><tt class="xref docutils literal"><span class="pre">GeoExt.data.LayerRecord</span></tt></a> objects.</dd></dl>

<dl class="attribute">
<dt id="GeoExt.PrintMapPanel.map">
<tt class="descclassname">PrintMapPanel.</tt><tt class="descname">map</tt><a class="headerlink" href="#GeoExt.PrintMapPanel.map" title="Permalink to this definition">¶</a></dt>
<dd><tt class="docutils literal"><span class="pre">OpenLayers.Map</span></tt> or <tt class="docutils literal"><span class="pre">Object</span></tt>  A map or map configuration.</dd></dl>

<dl class="attribute">
<dt id="GeoExt.PrintMapPanel.previewScales">
<tt class="descclassname">PrintMapPanel.</tt><tt class="descname">previewScales</tt><a class="headerlink" href="#GeoExt.PrintMapPanel.previewScales" title="Permalink to this definition">¶</a></dt>
<dd><tt class="docutils literal"><span class="pre">Ext.data.Store</span></tt> A data store with a subset of the printProvider&#8217;s
scales. By default, this contains all the scales of the printProvider.
If <tt class="docutils literal"><span class="pre">limitScales</span></tt> is set to true, it will only contain print scales
that can properly be previewed with this <a title="GeoExt.PrintMapPanel" class="reference internal" href="#GeoExt.PrintMapPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.PrintMapPanel</span></tt></a>.</dd></dl>

<dl class="attribute">
<dt id="GeoExt.PrintMapPanel.printPage">
<tt class="descclassname">PrintMapPanel.</tt><tt class="descname">printPage</tt><a class="headerlink" href="#GeoExt.PrintMapPanel.printPage" title="Permalink to this definition">¶</a></dt>
<dd><a title="GeoExt.data.PrintPage" class="reference external" href="../data/PrintPage.html#GeoExt.data.PrintPage"><tt class="xref docutils literal"><span class="pre">GeoExt.data.PrintPage</span></tt></a> PrintPage for this PrintMapPanel.
Read-only.</dd></dl>

<dl class="attribute">
<dt id="GeoExt.PrintMapPanel.printProvider">
<tt class="descclassname">PrintMapPanel.</tt><tt class="descname">printProvider</tt><a class="headerlink" href="#GeoExt.PrintMapPanel.printProvider" title="Permalink to this definition">¶</a></dt>
<dd><a title="GeoExt.data.PrintProvider" class="reference external" href="../data/PrintProvider.html#GeoExt.data.PrintProvider"><tt class="xref docutils literal"><span class="pre">GeoExt.data.PrintProvider</span></tt></a> PrintProvider for this
PrintMapPanel.</dd></dl>

</div>
<div class="section" id="public-methods">
<h2>Public Methods<a class="headerlink" href="#public-methods" title="Permalink to this headline">¶</a></h2>
<p>Public methods in addition to those
listed for <a class="reference external" href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.Panel">Ext.Panel</a>.</p>
<dl class="method">
<dt id="GeoExt.PrintMapPanel.print">
<tt class="descclassname">PrintMapPanel.</tt><tt class="descname">print</tt><big>(</big><big>)</big><a class="headerlink" href="#GeoExt.PrintMapPanel.print" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>options</em> &#8211; <tt class="docutils literal"><span class="pre">Object</span></tt> options for
the <a title="GeoExt.data.PrintProvider" class="reference external" href="../data/PrintProvider.html#GeoExt.data.PrintProvider"><tt class="xref docutils literal"><span class="pre">GeoExt.data.PrintProvider</span></tt></a> :: <tt class="docutils literal"><span class="pre">print</span></tt>  method.</td>
</tr>
</tbody>
</table>
<p>Convenience method for printing the map, without the need to
interact with the printProvider and printPage.</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
            <li class="right" style="margin-right: 10px">
              <a href="../../../genindex.html" title="General Index"
                 accesskey="I">index</a></li>
            <li class="right" >
              <a href="../../../modindex.html" title="Global Module Index"
                 accesskey="M">modules</a> |</li>
            <li class="right" >
              <a href="UrlLegend.html" title="GeoExt.UrlLegend"
                 accesskey="N">next</a> |</li>
            <li class="right" >
              <a href="Popup.html" title="GeoExt.Popup"
                 accesskey="P">previous</a> |</li>
        <li><a href="../../../index.html">GeoExt</a> &raquo;</li>
          <li><a href="../../index.html" >API Reference</a> &raquo;</li>
          <li><a href="../widgets.html" >Widgets</a> &raquo;</li>
        <li><a href="#"><tt class="docutils literal docutils literal"><span class="pre">GeoExt.PrintMapPanel</span></tt></a></li>
      </ul>
    </div>

    <div class="footer">
      &copy; Copyright 2009-2010, GeoExt Community.
    </div>
  </body>
</html>